//
//  ViewController.m
//  特效动画
//
//  Created by 耐克了解了 on 31/5/17.
//  Copyright © 2017年 耐克了解了. All rights reserved.
//

#import "ViewController.h"
#import "LiveZanViewController.h"
#import "FireworksViewController.h"
#import "TWScrollLabelController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableview;

@property (nonatomic,strong) NSArray *titles;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.tableview.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
}

#pragma mrk - UITableViewDataSource,UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.titles.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        
        cell.textLabel.text = self.titles[indexPath.row];
    }
    return  cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UIViewController *vc = nil;
    switch (indexPath.row) {
        case 0:
        {
            vc = [[LiveZanViewController alloc]init];
            break;
        }
        case 1:
        {
            vc = [[TWScrollLabelController alloc]init];
            break;
        }
        default:
            break;
    }
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - getter

- (NSArray *)titles
{
    if (!_titles) {
        _titles = @[@"直播点赞动画",@"弹幕",@"跑马灯"];
    }
    return  _titles;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
